
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ attribute name="id" required="true" rtexprvalue="true" description="Id to be set for the div"%>
<%@ attribute name="cssStyle" description="Provide any CSS style properties"%>
<%@ attribute name="cssClass" description="Provide any CSS classes"%>

<%@ attribute name="url" required="true" rtexprvalue="true" description="url to load div"%>
<%@ attribute name="loadComplete" description="Callback for load complete"%>
<%@ attribute name="deferredLoading" rtexprvalue="true" type="java.lang.Boolean" description="Load div on ready or not"%>


<script type="text/javascript">

$(document).ready(function() { 
    if('${deferredLoading}' == null || '${deferredLoading}' == true){
    	loadDiv('${id}', '${url}', '${loadComplete}');
    }
    
    $('#${id}').onShow(function(){
    	if($(this).html() == null){
    		loadDiv('${id}', '${url}', '${loadComplete}');
    	}
      });
    	
});

</script>
<div id="${id}" style="${cssStyle}" class="${cssClass}"></div>